// 2109. 向字符串添加空格
// AC: https://leetcode.cn/problems/adding-spaces-to-a-string/submissions/617017756/

class Solution {
public:
    string addSpaces(string s, vector<int>& spaces) {
        int l=0,n=spaces.size();
        string ss="";
        for(int i=0;i<s.size();++i){
            if(l<n&&spaces[l]==i){
                ss+=' ';
                l++;
            }
            ss+=s[i];
        }
        return ss;
    }
};